All Questions
53 questions
6votes
2answers
649views
When the stack frames become computationally expensive
I've been experimenting with different data structures and algorithms in Python, Java and C to see in what circumstances function/method inlining could bring meaningful gains in terms of the execution ...
-2votes
1answer
124views
What should I use to graphically represent an object's position on a fixed path using python(preferred)?
Consider 2 roads merging into one(This map is supposed to remain fixed). The program will not generate this map. The program will read this map and plot positions on it on its own. The python program ...
0votes
2answers
2kviews
Why are some languages called platform dependent if I can always share the source code?
I was reading about erlang when I read that it is platform-independent, using BEAM as the VM, now I understand that a VM compiles the byte code to machine code and this makes that language machine-...
43votes
3answers
17kviews
Why is the logical NOT operator in C-style languages "!" and not "~~"?
For binary operators we have both bitwise and logical operators: & bitwise AND | bitwise OR && logical AND || logical OR NOT (a unary operator) behaves differently though. There is ~ for ...
2votes
1answer
2kviews
Why did Java and C sharply dip in popularity around 2017 in the TIOBE index? [closed]
The TIOBE Programming Community Index shows Java and C dramatically falling in popularity between late 2016 and mid 2017 before rebounding by mid 2018. What is the cause of the volatility? Source: www....
7votes
1answer
11kviews
Difference between header files and interfaces
I wanted to know whether the header files in c and c++ have same function as that of interfaces used in Java? If not what is the difference between header file and interface?
2votes
3answers
525views
IOC container & accessing Implementation from the container
Background As mentioned in this article, Inversion of Control can be achieved through various mechanisms such as: Strategy design pattern, Service Locator pattern(SLP), Factory pattern, and ...
4votes
3answers
2kviews
How useful is JNI in android?
In java/android we can call code written in the c/c++ language for execution speed advantage. I have heard of Ahead Of Time compilation which (as far as i know) compiles the entire application to ...
2votes
3answers
3kviews
Return array pointers vs. populating an array inserted as a parameter?
Which is better? I noticed the latter is used in a lot of C code. People will typically malloc an array, and then pass that as a parameter to a function, which will then populate it. Whereas in Java, ...
6votes
10answers
4kviews
Is segfault always the programmer's mistake?
Is a segfault (array index out of bounds) always the programmer's mistake or could it be misuse from the user?
38votes
8answers
16kviews
Why exactly does Java not allow numeric conditionals like if(5) { ...} if C does?
I have these two little programs: C #include <stdio.h> int main() { if (5) { printf("true\n"); } else { printf("false\n"); } return 0; } Java class ...
-2votes
1answer
294views
What is best way to develop GUI for application written in C, and also add networking functionality in it?
I have an application written in C. I have to develop a GUI for it. This application will be connected to the internet and will send and receive requests and responses through the network. One way is ...
68votes
10answers
21kviews
Why do languages require parenthesis around expressions when used with "if" and "while"?
Languages like C, Java, and C++ all require parenthesis around an entire expression when used in an if, while, or switch. if (true) { // Do something } as opposed to if true { // Do ...
2votes
2answers
11kviews
Is main() function better on top of all other functions? [closed]
My college professor told me that main functions should be defined on top of other function definitions. We should use a forward declaration in order to accomplish this (we use C at that time). So yes,...
-2votes
1answer
349views
Problem on recursion
void function(int x){ if(x<=0) return; function(x--); } This is a recursion function which is called with the value of x = 20. The Recursive call will take place in this way ...